package com.ly.controller;

import com.ly.entity.FoodType;
import com.ly.service.FoodTypeService;
import com.ly.utils.ResposeData;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Tag(name = "菜品类型接口")
@CrossOrigin
@RestController
public class FoodTypeController {

    @Autowired
    private FoodTypeService foodTypeService;

    @Operation(summary = "查询菜品的分类")
    @GetMapping("/queryFoodType")
    public ResposeData queryFoodType(){
        List<FoodType> foodTypes = null;
        try {
            foodTypes = foodTypeService.queryAllFoodType();
            return ResposeData.ok().put("foodTypes",foodTypes);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
}
